package com.mezz.bones.im.common.event;

import com.mezz.bones.im.common.domain.user.ImUserConnectInfo;
import com.mezz.bones.im.common.result.ImResultCode;
import org.springframework.context.ApplicationEvent;

import java.io.Serializable;

/**
 * @Author: zhuang
 * @Date: 2024/12/2 13:41
 * @Description: 发送消息至某一设备(具体的连接)
 * @Version: 1.0
 **/

public class MessageSendWithConnectEvent extends ApplicationEvent implements Serializable {

    private String actionCode;
    private ImUserConnectInfo senderUserConnectInfo;
    private Object data;

    private Object traceId;

    private ImResultCode resultCode;

    public MessageSendWithConnectEvent(Object source, String actionCode, Object data, ImUserConnectInfo senderUserConnectInfo) {
        this(source,actionCode,data,senderUserConnectInfo,ImResultCode.SUCCESS);
    }

    public MessageSendWithConnectEvent(Object source, String actionCode, Object data, ImUserConnectInfo senderUserConnectInfo,ImResultCode resultCode) {
        super(source);
        this.traceId = this.source;
        this.data = data;
        this.actionCode = actionCode;
        this.senderUserConnectInfo = senderUserConnectInfo;
        this.resultCode = resultCode;
    }

    public ImUserConnectInfo getSenderUserConnectInfo() {
        return senderUserConnectInfo;
    }

    public Object getData(){
        return data;
    }

    public String getActionCode() {
        return actionCode;
    }

    public Object getTraceId() {
        return traceId;
    }

    public void setTraceId(Object traceId) {
        this.traceId = traceId;
    }

    public ImResultCode getResultCode() {
        return resultCode;
    }
}
